import { useTable, LIST_TYPE } from '@crud/index';
import { getLecBatchList } from '@/api/crm-agency/dyj/lecturer';

// 查询

// 表格
export const useTableList = (options: any = {}) => {
  const columns: any = [
    { label: '兑换类型', prop: 'code_type', minWidth: 120, fixed: 'left', render: (s: any) => s.row.code_type === 0 ? '兑换码' : '渠道码' },
    { label: '发放时间', prop: 'add_time', minWidth: 177, type: 'dateTime' },
    { label: '失效时间', prop: 'end_time', minWidth: 177, type: 'dateTime' },
    { label: '兑换时长', prop: 'batch_type', minWidth: 120 },
    { label: '发放总数', prop: 'total', minWidth: 120 },
    { label: '使用数', prop: 'used', minWidth: 120 },
    { label: '使用率', prop: 'used_percent', minWidth: 120, type: 'percent' },
    { label: '过期数', prop: 'expire', minWidth: 120 },
    { label: '过期率', prop: 'expire_percent', minWidth: 120, type: 'percent' },
    { label: '操作', align: 'center', width: 220, render: 'actions', fixed: 'right' }
  ];

  return useTable({
    ...options,
    type: LIST_TYPE.AGENCY,
    params: {},
    userLabelOptions: false,
    columns: columns,
    getList: getLecBatchList
  });
};
